<template>
  <div id="app">
    <button @click="getProduct">获取产品</button>
    <button @click="getProductById">获取产品根据ID</button>
    <button @click="getProductlist">获取产品列表</button>
    <button @click="addProduct">添加产品</button>
  </div>
</template>

<script>
export default {
  name: "App",
  methods: {
    async getProduct() {
      let result = await this.$http.get("/api/getProduct")
      console.log(result)
    },
    async getProductById() {
      let result = await this.$http.get("/api/getProductById/10")
      console.log(result)
    },
    async getProductlist() {
      let result = await this.$http.get("/api/getProductlist")
      console.log(result)
    },
     async addProduct() {
      let result = await this.$http.post("/api/addProduct",{name:'apple',price:'888'})
      console.log(result)
    }

  },
  components: {}
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
